package com.trkj.service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.trkj.dao.jpa.IJlRecipePayDAO;
import com.trkj.pojos.JlRecipePay;

@Service
@Transactional
public class JlRecipePayService {
	@Autowired
	private IJlRecipePayDAO JlRecipePayDAO;
	/*
	 * 查看IC卡信息
	 */
	public Map<String, Object> findJlRecipePayByPage(int page, int rows){
		PageRequest pr = new PageRequest(page - 1, rows);
		//获取当前页的记录
		List<JlRecipePay> list = JlRecipePayDAO.findJlRecipePayByPage(pr);
		//获取总的记录条数
		long total =  JlRecipePayDAO.count();		
		Map<String, Object> map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	public List<JlRecipePay>  icidtoJlRecipePay(BigDecimal irpId){
		return JlRecipePayDAO.icidtoJlRecipePay(irpId);
	}
	public void addJlRecipe2( BigDecimal irpId,Date rpDate,String rpFigurePerson ,BigDecimal rpNum){
		JlRecipePay recipe=new JlRecipePay();
		recipe.setIrpId(irpId);
		recipe.setRpDate(rpDate);
		recipe.setRpFigurePerson(rpFigurePerson);
		recipe.setRpNum(rpNum);
		JlRecipePayDAO.save(recipe);
	     }
}
